Skip to content

Gen2 migrations - support node 20 and 22 in functions#14140

Merged
abhi7cr merged 3 commits intomigrationsfrom
gen2-migrations-execute
Mar 15, 2025
Merged

Gen2 migrations - support node 20 and 22 in functions#14140
abhi7cr merged 3 commits intomigrationsfrom
gen2-migrations-execute

Conversation

@abhi7cr
Copy link
Copy Markdown
Contributor

@abhi7cr abhi7cr commented Mar 14, 2025

Description of changes

add node 20 and 22 version support for functions.

Description of how you validated changes

unit tests

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@abhi7cr abhi7cr requested review from a team as code owners March 14, 2025 22:31
@abhi7cr abhi7cr changed the title Gen2 migrations execute Gen2 migrations - support node 20 and 22 in functions Mar 14, 2025
assert.match(source, /name: /);
});
it('does render runtime property', () => {
test.each([[Runtime.nodejs16x], [Runtime.nodejs18x], [Runtime.nodejs20x], [Runtime.nodejs22x]])(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud, could we also pass the expectedRuntime of 16, 18, 20, 22 along with this and use it directly instead of parsing like const expectedRuntime = nodejsRuntime.split('nodejs')[1].split('.')[0]; What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good callout! The main reasoning for doing it this way in the test was to make sure we are deriving the expected version from the runtime string itself (as a source of truth). In this way, we can catch any regressions if we change the mapping in the actual switch case. Otherwise, we would need to maintain additional mapping in the test file, which could be prone to errors. Let me know what you think !

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, using the Runtime enum string from the lambda sdk as a source of truth. Yes, that makes sense.

@abhi7cr abhi7cr merged commit f3dd623 into migrations Mar 15, 2025
5 checks passed
@abhi7cr abhi7cr deleted the gen2-migrations-execute branch March 15, 2025 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants